package com.adinnet.admin.contact.controller;


import com.adinnet.admin.contact.model.Contact;
import com.adinnet.admin.contact.model.vo.ContactResp;
import com.adinnet.admin.contact.service.ContactService;
import com.adinnet.admin.order.model.vo.OrderReq;
import com.adinnet.admin.order.model.vo.OrderResp;
import com.adinnet.admin.system.model.vo.SysUserInfo;
import com.adinnet.core.JsonResult;
import com.adinnet.core.PageResult;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
 * <p>
 * 联系我们（意见反馈） 前端控制器
 * </p>
 *
 * @author zYshuai
 * @since 2020-12-17
 */
@Controller
@RequestMapping("admin/contact")
public class ContactController {


    @Autowired
    private ContactService contactService;

    @RequestMapping()
    public String contact(Model model) {
        return "contact/contact.html";
    }


    /**
     * 意见收集列表
     **/
    @ResponseBody
    @RequestMapping("/list")
    public PageResult<ContactResp> list(Integer page,Integer limit) {
        if (page == null || limit == null) {
            page = 1;
            limit = 10;
        }
        return contactService.contactList(page,limit);
    }


    /**
     * 修改状态
     **/
    @ResponseBody
    @RequestMapping("/updateStatus")
    public JsonResult updateStatus(Integer id, String remark, HttpServletRequest request) {
        return contactService.updateStatus(id, remark,request);
    }


}
